package com.example.redis.demo.exception;

public class BusinessException extends RuntimeException {


    private String message;

    private String code;

    public BusinessException(String message) {
        super(message);
        this.message = message;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public BusinessException(String message, String code) {
        super(message);
        this.message = message;
        this.code = code;
    }


    public static BusinessException error(String message) {
        return new BusinessException(message, "500");
    }


    public static BusinessException errorOfCode(String message, String code) {

        return new BusinessException(message, code);
    }


    public static BusinessException success(String message) {
        return new BusinessException(message, "200");
    }
}
